package leetcode.tree;

import leetcode.tree.common.TreeNode;
import leetcode.tree.common.TreeUtils;

import java.util.Arrays;

/**
 * Definition for a binary tree node.
 * public class TreeNode {
 *     int val;
 *     TreeNode left;
 *     TreeNode right;
 *     TreeNode() {}
 *     TreeNode(int val) { this.val = val; }
 *     TreeNode(int val, TreeNode left, TreeNode right) {
 *         this.val = val;
 *         this.left = left;
 *         this.right = right;
 *     }
 * }
 */
class Solution501 {
    public int[] findMode(TreeNode root) {
        return TreeUtils.findMode(root);

    }
}

public class leetcode501 {
    public static void main(String[] args) {
        Solution501 solution501 = new Solution501();
        Integer[] root = {1,null,2,2};
        test501(solution501, root);
    }

    private static void test501(Solution501 solution501, Integer[] root) {
        System.out.println(Arrays.toString(solution501.findMode(TreeUtils.generateLeetcodeTree(root))));
    }
}
